package tmall.framework.response;

import lombok.Data;

@Data
public class ResponseResult<T> {
    public static final String SUCCESS = "success";
    public static final String ERROR = "error";
    public static final String SUCCESS_CODE = "10000";

    private String retCode;
    private String retMsg;
    private T data;

    public static ResponseResult success(Object data){
        ResponseResult responseResult = new ResponseResult();
        responseResult.retCode = SUCCESS_CODE;
        responseResult.retMsg = SUCCESS;
        responseResult.data = data;
        return responseResult;
    }

    public static ResponseResult failed(String failed,String retCode){
        ResponseResult responseResult = new ResponseResult();
        responseResult.retCode = retCode;
        responseResult.retMsg = ERROR;
        responseResult.data = failed;
        return responseResult;
    }
}
